wxMenuItems must have a wxMenu parent.
Parameters for creating a new menuitem:
- atom parentMenu
- integer id
- text
- helpString [ = ""]
- integer checkable [ = 0]
- atom subMenu [ = 0]
To create a submenu, you first need to create a
wxMenu with no parent, and
pass the result in the
subMenu parameter.
To set up event handlers for menus, use the wxEVT_COMMAND_MENU_SELECTED event type.
wxMenu controls now derive from wxEvtHandler, so you should set events with the
menu now, not a parent control.
code
ex:
procedure on_open_menu( atom this, atom event )
-- do stuff
end procedure
-- if you used a specific wxID_ constant when you created the wxMenuItem, you could
-- use that instead of get_menuitem_id: wxID_OPEN, wxID_NEW, etc
set_event_handler( the_open_menu_parent, get_menuitem_id( the_open_menu ),
wxEVT_COMMAND_MENU_SELECTED, routine_id("on_open_menu"))
endcode
Parent Topics:
Classes
Menus